<?php

header("Access-Control-Allow-Origin: *");
//分光器查询
include_once '../../library/config.php';
include_once '../../model/gponfenguangqilist.php';

$entity = new GponFenGuangQi();
$list = new GponFenGuangQi();
$entity->request();

try {

    $val = $entity['val'];
    $list->select()->where("name like'%" . $val . "%'")->orderby("convert(name using gbk) asc")->query();
    $arr = array();
    $list->remove(array('id'));
    while ($list->for_in_rows()) {
        array_push($arr, [
           "末级分光器名称"=>$list['name'],
           "配比2"=>$list['marching2'],
           "安装位置及覆盖"=>$list['place']
        ]);
    }
    echo json_encode($arr);
} catch (Exception $exc) {
    echo $list->rsscode($exc);
}